package com.link.base.core.basic.config.mvc;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

/**
 * 处理Long型数据经过mvc处理丢失精度的问题
 *
 * @author LiYang
 * @date 20190426
 */
public class CustomerLongTypeMapper extends ObjectMapper {

    public CustomerLongTypeMapper() {
        super();
        SimpleModule simpleModule = new SimpleModule();
        simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
        simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
        registerModule(simpleModule);
    }
}
